const menuAPI = {
  queryMenuList: param => {
    return $http.post(`${window.RPConfig.mgt}/menu/list/page`, param).then(response => response.data);
  },
  addMenu: param => {
    return $http.post(`${window.RPConfig.mgt}/menu/add`, param).then(response => response.data);
  },
  getMenuDetail: id => {
    return $http.post(`${window.RPConfig.mgt}/menu/detail?menuId=${id}`).then(response => response.data);
  },
  updateMenu: param => {
    return $http.post(`${window.RPConfig.mgt}/menu/update`, param).then(response => response.data);
  },
  deleteMenu: param => {
    return $http.post(`${window.RPConfig.mgt}/menu/deleteByIds`, param).then(response => response.data);
  },
  queryResourceTree: menuId => {
    return $http.post(`${window.RPConfig.mgt}/menu/findFunctionTree?menuId=${menuId}`).then(response => response.data);
  },
  queryAssignedResourceTree: menuId => {
    return $http.post(`${window.RPConfig.mgt}/menu/findTreeByMenuId?menuId=${menuId}`).then(response => response.data);
  },
  addAssignedResource: param => {
    return $http.post(`${window.RPConfig.mgt}/menu/resource/add`, param).then(response => response.data);
  },
  // updateAssignedResource: param => {
  //   return $http.post(`${window.RPConfig.mgt}/menu/resource/update`, param).then(response => response.data);
  // },
  deleteAssignedResource: param => {
    return $http.post(`${window.RPConfig.mgt}/menu/resource/delete`, param).then(response => response.data);
  }
};
export default menuAPI;
